<?php

//use yii\web\View;

use yii\helpers\Url;

echo $this->render('/layouts/header');

?>

<div style="margin:0px auto; width:640px;">

    <div style="">名称：<input id="name" type="text" value="<?php echo isset($task["name"]) ? $task["name"] : "";?>"/></div><br>
    <div style="">标识：<input id="impl_class" type="text" value="<?php echo isset($task["impl_class"]) ? $task["impl_class"] : "";?>"/></div><br>
    <div style="">分页数据：<input id="pagedata" type="text" value="<?php echo isset($task["pagedata"]) ? $task["pagedata"] : "";?>"/></div><br>
    <div style="">总页数：<input id="page_sum" type="text" value="<?php echo isset($task["page_sum"]) ? $task["page_sum"] : "";?>"/></div><br>

    <input id="create_button" type="button" value="提交"/>
<br>

<script language="javascript">

    var task_id = <?php echo $id?>;
//    var task = <?php ?>;

    $(document).ready(function () {
        $('#create_button').on('click', function () {

            let name = $('#name').val();
            let impl_class = $('#impl_class').val();
            let pagedata = $('#pagedata').val();
            let page_sum = $('#page_sum').val();

            $.ajax({
                url : "<?php echo Url::to(["async-edit"])?>",
                type : 'POST',
                dataType : 'json',
                data : {
                    id : task_id,
                    name : name,
                    impl_class : impl_class,
                    pagedata : pagedata,
                    page_sum : page_sum,
                },
                success : function (result) {
                    console.log(result);
                    if(result.code == 200){
                        alert("成功");
                        //parent.layer.closeAll();
                        parent.window.location.reload();
                    }else{
                        alert(result.info);
                    }
                }
            });
        });
    });

</script>

